#!/bin/bash
dt=`date -d '1 days ago' '+%Y-%m-%d'`

nohup hive -hivevar etl_dt="$dt" -f /hive_ods_dwd/ods_dwd_day.sql & > /hive_ods_dwd/add.log
if test $? -eq 1
then
	# 运行失败则退出
	echo "ODS-DWD 报错"
	exit
fi

nohup hive -hivevar etl_dt="$dt" -f /hive_ods_dwd/ods_dwd_month.sql & > /hive_ods_dwd/add.log
then
	# 运行失败则退出
	echo "ODS-DWD 报错"
	exit
fi

nohup hive -hivevar etl_dt="$dt" -f /hive_dwd_dws/dwd_dws.sql & > /hive_dwd_dws/add.log
then
	# 运行失败则退出
	echo "DWD-DWS 报错"
	exit
fi

nohup hive -hivevar etl_dt="$dt" -f /hive_dws_ads/dws_ads.sql & > /hive_dws_ads/add.log
if test $? -ne 0
then
	# 运行失败则退出
	echo "DWS-ADS 报错"
	exit
fi